package org.xhs.geomap.net
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	
	public class PriceXMLParser
	{
		private var loader:URLLoader;
		private var xml:XML;
		private var priceArray:Array = new Array();
		
		public function PriceXMLParser()
		{
		}
		
		public function parse(url:String):Array
		{
			var urlrequest:URLRequest = new URLRequest(url);
			loader = new URLLoader(urlrequest);
			loader.addEventListener(Event.COMPLETE, loadcomplete);
			return priceArray;
		}
		
		public function loadcomplete(eve:Event):void 
		{
			xml = new XML(loader.data);
			for(var i:Number = 0;i < xml.Row.length();i++)
			{
				var bPrice:Object = new Object();
				bPrice.id = xml.Row[i].@ccode;
				bPrice.type = xml.Row[i].@mcode;
				bPrice.price = xml.Row[i].@price;
				priceArray.push(bPrice);
			}
		}
	}
}